<template>
    <div>
        姓名：
        <input type="text" v-model="farch.name" >
        科室:  
        <select v-model="farch.id">
                        <option value="">请选择</option>
                        <option :value="o.kid" v-for="o in Ken">{{ o.kName }}</option>
                    </select>
        <input type="button" value="查询" @click="Show" >
        <table>
            <thead>
                <tr>
                    <td>姓名</td>
                    <td>头像</td>
                    <td>科室</td>
                    <td>创建日期</td>
                    <td>所属医院</td>
                    <td>功能</td>
                </tr>

                <tr v-for="o in info.list" >
                    <td>{{ o.dName }}</td>
                    <td><img :src="o.img" width="60px" height="60px" ></td>
                    <td>{{ o.kName }}</td>
                    <td>{{ moment(o.ddate).format("yyyy-MM-DD") }}</td>
                    <td>{{ o.add }}</td>
                    <td>功能</td>
                </tr>
            </thead>
        </table>
        <Span>共{{ info.zt }}行</Span>
        <Span>共{{ info.zy }}页</Span>
        <Span>当前{{ farch.pazeindex }}/{{ info.zy }}页</Span>
        <Span>每页{{ farch.pazesazi }}行</Span>
        <input type="button" value="首页" @click="Famy(1)" >
        <input type="button" value="上一页" @click="Famy(farch.pazeindex-1)" >
        <input type="button" :value="o" v-for="o in info.zy" @click="Famy(o)" >
        <input type="button" value="下一页" @click="Famy(farch.pazeindex+1)" >
        <input type="button" value="尾页" @click="Famy(info.zy)" ></input>

    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import moment from 'moment';
import { onMounted, ref } from 'vue';

onMounted(()=>{
    Listt();
    Show();
})
const Famys=(e:any)=>{
    console.log(e);
    farch.value.pazesazi=e;
    Show();
}


const Famy=(e:any)=>{
    console.log(e);
    farch.value.pazeindex=e;
    Show();
}

let fsd:any=ref([2,4,6]);

let info:any=ref({
    list:[],
    zt:0,
    zy:0
});

let farch:any=ref({
    name:"",
    id:"",
    pazeindex:1,
    pazesazi:3
})

const Show=()=>{
    axios({
        url:'https://localhost:7030/api/User/ShowD',
        method:'get',
        params:farch.value
    })
    .then((res)=>{
        console.log(res);
        Object.assign(info.value,res.data);
    } )
}


let Ken:any=ref([]);

const Listt=()=>{
    axios({
        url:"https://localhost:7030/api/User/ListK",
        method:'get',
    })
    .then((res)=>{
        console.log(res);
        Ken.value=res.data;
    })
}

</script>

<style scoped>

</style>
